<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
	String path =  request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() +  path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath %>" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>贷款管家</title>
</head>
<body>
<div class="modal-dialog">
	<div class="modal-content">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal"
				aria-hidden="true">X</button>
			<h3 id="myModalLabel">发送消息</h3>
		</div>
		<div class="modal-body">
			<form class="form-horizontal" method="post" id="sendMessageForm" action="message/send/save${empty entity?'Insert':'Update' }.htm" role="form">
					<div class="form-group" >
						<label class="col-sm-2 control-label">类型<font color="red">&nbsp;*</font></label> 
						<div class="col-sm-10">
							<select class="form-control" id="message_type" name="type">
								<option value="1">个人信息</option>
								<option value="2">通知信息</option>
								<option value="3">活动消息</option>
							</select>
						</div>
					</div>

					<div class="form-group">
						<label class="col-sm-2 control-label">标题<font color="red">&nbsp;*</font></label>
						<div class="col-sm-10">
							<input type="text" id="message_title" class="form-control" name="title" value="">
						</div>
					</div>		
								
					<div class="form-group">
						<label class="col-sm-2 control-label">发送对象</label>
						<div class="col-sm-10">
							<label class="checkbox-inline"> 
								<input type="radio" name="sendType" value="1" checked onclick="clickSendType(1)"> 指定用户发送
							</label> 
							<label class="checkbox-inline"> 
								<input type="radio" name="sendType" value="2" onclick="clickSendType(2)"> 所有用户
							</label>
						</div>
					</div>

					<div class="form-group" style="display:block;">
						<label class="col-sm-2 control-label">用户手机号码<font color="red">&nbsp;*</font></label>
						<div class="col-sm-10" >
						    <textarea name = "phoneNum" id = "phoneNum" class="form-control" rows="6" placeholder="输入多个手机号时用空格或者逗号隔开"></textarea> 
						</div>
					</div>	
						
					<div class="form-group">
						<label class="col-sm-2 control-label">内容<font color="red">&nbsp;*</font></label>
						<div class="col-sm-10">
							<textarea name = "content" id="message_content" class="form-control" rows="6"></textarea> 
						</div>
					</div>
				<span id="tip" style="color: red;font-size: 14px;margin-left:20px; "></span>
			</form>
		</div>
		<div class="modal-footer">
			<button class="btn btn-default" data-dismiss="modal"
				aria-hidden="true">取消</button>
			<button class="btn btn-primary" data-dismiss="modal">发送</button>
		</div>
	</div>
</div>
</body>

<script type="text/javascript">
	function check_fun(){
		$("#tip").html("");
		var b = true;
		var content = $("#message_content").val();
		var phoneNum = $("#phoneNum").val();
		var title = $("#message_title").val();
		var messageType = $("#message_type").val();
		alert("手机号等于："+phoneNum);
		if(content == null || content.trim() == ''){
			$("#tip").html("请输入内容");
			b = false;
		}
		if(messageType == 1){
			if(phoneNum == null || phoneNum.trim() == ''){
				$("#tip").html("请输入手机号");
				b = false;
			}
		}
		if(title == null || title.trim() == ''){
			$("#tip").html("请输入标题");
			b = false;
		}
		if(messageType == null || messageType.trim() == ''){
			$("#tip").html("请选择类型");
			b = false;
		}
		return b;
	}
	function clickSendType(value) {
		if (value == 1) {
			$("#cellPhoneDiv").css("display",'block');
			$("#cellPhone").val("");
		} else if (value == 2) {
			$("#cellPhoneDiv").css("display",'none');
		}
	}

</script>
</html>